/*
 *    Copyright © OpenAtom Foundation.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package com.inspur.edp.bef.dtgenerator.core.rtgen.repositorygen;

import com.inspur.edp.bef.dtgenerator.core.rtgen.repositorygen.bemaindacgen.CacheConfigIDPropGenerator;
import com.inspur.edp.bef.dtgenerator.core.rtgen.repositorygen.bemaindacgen.UseDataCachePropGenerator;
import com.inspur.edp.caf.generator.property.ClassPropertyGenerator;
import com.inspur.edp.caf.generator.property.PropertyGenerator;
import com.inspur.edp.cef.generator.repository.CefRepoAssembler;
import com.inspur.edp.cef.generator.repository.dac.MainEntityDacGeneratorcs;
import com.inspur.edp.cef.generator.repository.repository.nestedrepository.DataTypeReposGenContext;
import com.inspur.edp.cef.repository.assembler.entity.MainEntityAssembler;
import com.inspur.edp.das.commonmodel.IGspCommonObject;

import java.util.ArrayList;

public class BEMainDacGenerator extends MainEntityDacGeneratorcs
{
	public BEMainDacGenerator(DataTypeReposGenContext reposContext)
	{
		super((IGspCommonObject) reposContext.getCefContext().getCefGenContext().getCommonDataType(), reposContext);
	}

	@Override
	protected ArrayList<ClassPropertyGenerator> createPropertyGenerators()
	{
ArrayList<ClassPropertyGenerator> list = super.createPropertyGenerators();
		if (list == null)
		{
			list = new java.util.ArrayList<ClassPropertyGenerator>();
		}
//		MainEntityAssembler mainEntityAssembler = (MainEntityAssembler)((super.BaseAssembler.getAssemblerInstance() instanceof MainEntityAssembler) ? super.BaseAssembler.getAssemblerInstance() : null);
		CefRepoAssembler cefRepoAssembler = new CefRepoAssembler((IGspCommonObject) getDataTypeDacGenContext().getReposContext().getCefContext().getCefGenContext().getCommonDataType(), getDataTypeDacGenContext().getReposContext().getCefContext());
		list.add(new UseDataCachePropGenerator(cefRepoAssembler.getUseDataCache()));
		list.add(new CacheConfigIDPropGenerator(cefRepoAssembler.getCacheConfigID()));
		return list;
	}

}
